
function getDateStr(time) {
    var date = (typeof time === 'number' && time > 0) ? new Date(time) : new Date();
    return date.getFullYear() + '-' + getFullMonth(time) + '-' + date.getDate();
}

function getFullMonth(time) {
    var date = (typeof time === 'number' && time > 0) ? new Date(time) : new Date();
    var m = (date.getMonth() + 1).toString();
    if (m.length === 1) {
        m = '0' + m;
    }
    return m;
}

// console.log(getDateStr());

exports.getDateStr = getDateStr;